﻿#include "FITKAbaStepManager.h"
#include "FITKAbaStepInit.h"

namespace Interface
{
    FITKAbaStepManager::FITKAbaStepManager()
    {
        FITKAbaStepInit* initStep = new FITKAbaStepInit;
        initStep->setDataObjectName("Initial");
         this->appendDataObj(initStep);
    }


    void FITKAbaStepManager::insertDataObj(int index, Core::FITKAbstractDataObject* item)
    {
        //不允许插入到最前面
        if (index == 0)
            this->appendDataObj(item);
        else
            Core::FITKAbstractDataManager<FITKAbaAbstractStep>::insertDataObj(index,item);
    }

    

    void FITKAbaStepManager::removeDataObj(Core::FITKAbstractDataObject* obj)
    {
        //不允许删除第0个
        const int index = this->getDataIndex(obj);
        if (index == 0) return;
        Core::FITKAbstractDataManager<FITKAbaAbstractStep>::removeDataObj(obj);
    }

    void FITKAbaStepManager::removeDataByIndex(int index)
    {
        if (index == 0) return;
        Core::FITKAbstractDataManager<FITKAbaAbstractStep>::removeDataByIndex(index);
    }

    void FITKAbaStepManager::removeDataByID(int id)
    {
        auto data = this->getDataByID(id);
        this->removeDataObj(data);
    }

    void FITKAbaStepManager::removeDataByName(const QString &name, bool s)
    {
        auto data = this->getDataByName(name,s);
        this->removeDataObj(data);
    }

}

